function setCookie(name,value,iDay){
    if(iDay){
        //设置时间
        var oDate=new Date();
        oDate.setDate(oDate.getDate()+iDay);
        document.cookie=name+'='+value+';path=/;expires='+oDate;
    }else{
        document.cookie=name+'='+value+';path=/';
    }
}

function getCookie(name){
    var str=document.cookie;
    var arr=str.split('; ');

    for(var i=0;i<arr.length;i++){
        var arr2=arr[i].split('=');//arr2 [aaa,111]
        if(arr2[0]==name){
            return arr2[1];
        }
    }
    return '';
}

function removeCookie(name){
    setCookie(name,'',-2);
}